package com.heima.comment.controller;

import com.heima.comment.service.CommentService;
import com.heima.model.common.dtos.CommentRepayDto;
import com.heima.model.common.dtos.CommentRepayLikeDto;
import com.heima.model.common.dtos.CommentRepaySaveDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay")
@Slf4j
public class CommentRepayController {
    @Autowired
    private CommentService commentService;

    /**
     * app评论回复点赞
     *
     * @return
     */
    @PostMapping("/like")
    public ResponseResult commentRepayLike(@RequestBody CommentRepayLikeDto commentRepayLikeDto) {
        log.info("app评论回复点赞: {}", commentRepayLikeDto);
        return commentService.commentRepayLike(commentRepayLikeDto);
    }

    /**
     * app端文章评论回复
     * @param commentRepaySaveDto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveRepay(@RequestBody CommentRepaySaveDto commentRepaySaveDto) {
        log.info("app端文章评论回复: {}", commentRepaySaveDto);

        return commentService.saveRepay(commentRepaySaveDto);

    }

    /**
     * 查询评论回复列表
     *
     * @return
     */
    @PostMapping("/load")
    public ResponseResult commentRepayRoad(@RequestBody CommentRepayDto commentRepayDto) {
        log.info("查询评论回复列表：{}", commentRepayDto);
        return commentService.commentRepayRoad(commentRepayDto);
    }
}
